class Solution:
    def maximumTime(self, time: str) -> str:
        maxv=[2,9,5,9]
        result=""
        if time[0]=="?":
            if time[1]=="?":
                result+="23:"
            elif int(time[1])<4:
                result+="2"+time[1]+":"
            else:
                result+="1"+time[1]+":"
        elif time[1]=="?":
            if int(time[0])<2:
                result+=time[0]+"9:"
            else:
                result+=time[0]+"3:"
        if time[3]=="?":
            if time[4]=="?":
                result+="59"
            else:
                result+="5"+time[4]
        elif time[4]=="?":
            result+=time[3]+"9"
        else:
            result+=time[3:]
        return result

s=Solution()
print(s.maximumTime("??:??"))